﻿@model IEnumerable<ClinicaMVC3.Models.Paciente>
@{
    
}
<h2>
    Listagem de @ViewBag.Title
</h2>
<p>
    @Html.ActionLink("Novo", "Create")
</p>
@if (Model.Count() == 0)
{
    <span>Não há registros para listar.</span>
}
else
{


    <table class="tbl display">
        <thead>
        <tr>
            <th>
                @Html.LabelFor(model => new ClinicaMVC3.Models.Paciente().Nome)
            </th>
            <th>
                @Html.LabelFor(model => new ClinicaMVC3.Models.Paciente().Endereco)
            </th>
            <th>
                @Html.LabelFor(model => new ClinicaMVC3.Models.Paciente().DataNascimento)
            </th>
            <th></th>

        </tr>
        </thead>
        <tbody>
        @foreach (var item in Model)
        {
            <tr>
                <td>
                    @Html.DisplayFor(modelItem => item.Nome)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.Endereco)
                </td>
                <td>

                    @if (item.DataNascimento.HasValue){ @MvcHtmlString.Create(item.DataNascimento.Value.ToShortDateString())}
                    
                </td>
                <td>
                    @Html.ActionLink("Editar", "Edit", new { id = item.PacienteId }) 
                    @Html.ActionLink("Visualizar", "Details", new { id = item.PacienteId }) 
                    @Html.ActionLink("Excluir", "Delete", new { id = item.PacienteId })
                </td>
            </tr>
        }
        </tbody>
    </table>
}
